<template>
    <svg :class="svgClass" aria-hidden="true">
        <use :xlink:href="iconName" />
    </svg>
</template>

<script>
export default {
    name: "SvgIcon",
    props: {
        iconClass: {
            type: String,
            required: false,
        },
        className: {
            type: String,
            default: "",
        },
        name: {
            type: String,
            default: "",
        },
    },
    computed: {
        iconName() {
            let name = this.name || this.iconClass;
            return `#icon-${name}`;
        },
        svgClass() {
            return this.className ? "svg-icon " + this.className : "svg-icon";
        },
    },
};
</script>

<style scoped>
.svg-icon {
    fill: currentColor;
    overflow: hidden;
}
</style>
